<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>借贷客服</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/local_zh.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src='../base/base.js'></script>
</head>

<body>
<script>
    $(function () {
        var resp = AjaxUtil.isLogin();
        if (!resp) return;

        var module = ['overdue_list', 4, 'overdue_list2', 8];

        var bootstrapTableLeft = {
            columns: [{
                field: 'email',
                title: '邮箱',
                align: 'center',
            }, {
                field: 'phone',
                title: '手机号',
                align: 'center',
            }, {
                field: 'overdueCount',
                title: '当前未还笔数',
                align: 'center',
            }, {
                field: 'maxDay',
                title: '最大逾期天数',
                align: 'center',
                formatter: function (value, row, index) {
                    return FormatUtil.formatOverdueTime(value)
                }
            }],
            onClickRow: function (row) {
                $('#overdue_list2_table').bootstrapTable('refresh', {'query': {userId: row.userId}});
            }
        }
        var bootstrapTableRight = {
            columns: [ {
                field: 'borrowingOrderNo',
                title: '逾期单号',
                align: 'center',
            }, {
                field: 'nper',
                title: '期数',
                align: 'center',

            }, {
                field: 'endRepaymentDate',
                title: '还款时间',
                align: 'center',
                formatter: function (value, row, index) {
                    return FormatUtil.formatDateTime(value)
                }
            }, {
                field: 'returnMoney',
                title: '本金',
                align: 'center',

            }, {
                field: 'returnDividend',
                title: '利息',
                align: 'center',

            }, {
                field: 'defaultMoney',
                title: '违约金',
                align: 'center',

            }, {
                title: '总计金额',
                align: 'center',
                formatter: function (value, row, index) {
                    var suffix = ""
                    if(row.borrowingType == 10){
                        suffix = "BTC"
                    }
                    else if(row.borrowingType == 20){
                        suffix = "ETH"
                    }
                    else if(row.borrowingType == 100){
                        suffix = "BHPC"
                    }
                    else{
                        suffix = "未知"
                    }
                    return (row.returnMoney+row.returnDividend+row.defaultMoney).toFixed(6)+suffix
                }

            }, {
                field: 'endRepaymentDate',
                title: '已逾期天数',
                align: 'center',
                formatter: function (value, row, index) {
                    return FormatUtil.formatOverdueTime(value)
                }
            }]
        };
        var config = {
            listUrlRight: 'overdue_list/find_overdue_installment',//右边获取列表Url
        }

        overdue_list = DoubleTablePageCreateUtil.createInstance(module, null, null, null, null, bootstrapTableLeft, bootstrapTableRight, config); // 初始化完成
        overdue_list.query = function () {
            $("#overdue_list_table").bootstrapTable('refresh', {
                'query': {
                    storeId: $("#storeId").val(),
                }
            });
            return false;
        }
        overdue_list.reverseStatus = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#overdue_list_table');
            if (!row) return false;
            var resp = AjaxUtil.postJson('overdue_list/reverseStatus', {
                accountId: row.accountId
            });
            if (resp) {
                SwalUtil.success(resp.msg);
                $('#overdue_list_table').bootstrapTable('refresh');
            }
        };
    });
</script>
</body>

</html>